/*
 * @(#)IndustryQueryParasBuilder.java
 * Copyright (c) 2011 TravelSky Technology Ltd. All Right Reserved. 
 */
package com.meetingshow.meeting.service.util;

import java.util.Map;

import org.apache.commons.lang.StringUtils;
import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseQueryParasBuilder;
import com.meetingshow.meeting.service.model.IndustryQueryParas;

public class IndustryQueryParasBuilder extends BaseQueryParasBuilder {
    public static QueryStruct industryQueryBuilder(QueryStruct queryStruct, IndustryQueryParas industryQueryParas) throws Exception {
        builderInit(industryQueryParas, queryStruct);
        Map<String, Object> exactMap = queryStruct.getExactMap();
        Map<String, String> mistinessMap = queryStruct.getMistinessMap();
        
        if (StringUtils.isNotBlank(industryQueryParas.getIndustryId_e())) {
            exactMap.put(IndustryServiceParas.INDUSTRYPO_INDUSTRYID, Integer.valueOf(industryQueryParas.getIndustryId_e()));
        }
        if (StringUtils.isNotBlank(industryQueryParas.getParentId_e())) {
            exactMap.put(IndustryServiceParas.INDUSTRYPO_PARENTID, Integer.valueOf(industryQueryParas.getParentId_e()));
        }
        if (StringUtils.isNotBlank(industryQueryParas.getName())) {
            mistinessMap.put("upper(" + IndustryServiceParas.INDUSTRYPO_NAME + ")", industryQueryParas.getName().toUpperCase());
        }
        if (StringUtils.isNotBlank(industryQueryParas.getNameEn())) {
            mistinessMap.put("upper(" + IndustryServiceParas.INDUSTRYPO_NAMEEN + ")", industryQueryParas.getNameEn().toUpperCase());
        }
        pageBuilder(queryStruct, industryQueryParas);
        
        return queryStruct;
    }
}
